﻿function Setcurrent() {
    var urlCurrent = window.location.href;
    var currentPage = urlCurrent.substring(urlCurrent.lastIndexOf("/") + 1);
    var pagename;
    if (currentPage.indexOf(".") > 0) {
        pagename = currentPage.split(".")[0];
    }
    switch (pagename) {
        case "":
        case "Index":
            SetActivemenubar(1);
            SetActivemenubar(1);
            break;
        case "Dangki":
            SetActiveTopLink(2);
            break;
        case "CurrentPoint":
            SetActiveTopLink(3);
            break;
        case "Thongtincanhan":
        case "Doimatkhau":
        case "Capnhatthongtin":
            SetActiveTopLink(4);
            SetActivemenubar(7);
            break;
    }
}

function SetActiveTopLink(itemIndex) {
    if (itemIndex == -1) {
        $("#top_links ul li a").removeClass("active");
    }
    else {
        $("#top_links ul li a").removeClass("active");
        $("#top_links ul li").eq((itemIndex - 1)).find("a").addClass("active");
    }
}
function SetActivemenubar(itemIndex) {
    $("#nav ul li a").removeClass("active");
    $("#nav ul li").eq(itemIndex - 1).find("a").addClass("active");
}
function refreshImage() {
    $.ajax({
        type: 'POST',
        url: "../captcha/Captcha.ashx",
        success: function () {
            $("#imgCaptcha").attr("src", "../captcha/Captcha.ashx");
        }
    });
}